{% extends 'backend/base.html' %}
{% load static %}

{% block content %}
    <form action="" method="post">
        {% csrf_token %}
        <div class="add_article">
            <div class="alert-success text-center">添加文章</div>

            <div class="add_artitle_region">
                <div class="title form-group">
                    <label for="title">标题</label>
                    <div>
                        <input type="text" name="title" id="title">
                    </div>
                </div>

                <div class="content form-group">
                    <label for="article_content">内容（Kindeditor编辑器，不支持拖放/粘贴上传图片）</label>
                    <div>
                        <textarea name="content" id="article_content" cols="30" rows="10"></textarea>
                    </div>
                </div>
                <input type="submit" class="btn btn-default" value="提交">
            </div>
        </div>
    </form>
    <script charset="utf-8" src="{% static 'kindeditor/kindeditor-all.js' %}"></script>
    <script charset="UTF-8" src="{% static 'kindeditor/lang/zh-CN.js' %}"></script>
    <script>
        KindEditor.ready(function (K) {
            window.editor = KindEditor.create('#article_content', {
                width: "800",
                height: "600",
                resizeType: 0,
                uploadJson: "/upload/",
                extraFileUploadParams: {
                    csrfmiddlewaretoken: $("[name='csrfmiddlewaretoken']").val()
                },
                {#resizeType:2,#}
                filePostName: "upload_img"
            });
        });
        {#console.log("是否返回数据了");#}

    </script>

{% endblock %}